<?php

namespace Modules\DataAnalysis\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class SystemSettingRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'type' => ['required', Rule::in([1, 2])],
            'collect_user_info' => ['required_if:type,1'],
            'collect_comment_reply' => ['required_if:type,1'],
            'score_line' => ['required_if:type,2'],
            'edit_comment_score' => ['required_if:type,2'],
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
}
